<%-- 
    Document   : main.jsp
    Created on : 01/10/2009, 18:45:32
    Author     : MB
--%>

<%@page import="data.FuncionarioDO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HttpSessionDemo - Pagina Principal</title>
    </head>
    <body>
<%
    // VERIFICACAO MANUAL DO LOGIN
    if ( session.getAttribute("user_name") == null) {
       pageContext.forward("index.jsp");
    }
    String nome = new String();
    transacoes.Funcionario p = new transacoes.Funcionario();
    FuncionarioDO fdo = new FuncionarioDO();
    
    int id = (Integer)session.getAttribute("user_ID");
    fdo = p.buscar(id);
    if(null != fdo){
        nome = fdo.getNome();
        session.setAttribute("user_name", nome);
    }
    else {
        pageContext.forward("index.jsp");
    }
   
%>
    <h1>  Bom dia <%= nome %> !! </h1>
    <p>
  <ul>   
  <li><a href="./insertUser.jsp">Inserir Contato</a>
  <li><a href="./insertConsulta.jsp">Marcar Consulta</a>
  <li><a href="./update.jsp">Editar Contato</a>
  <li><a href="./search.jsp">Pesquisar Contato</a>
  </ul>
    </body>
</html>
